package com.bestv.datalake.service;

import com.bestv.datalake.mapper.LogRulerMapper;
import com.bestv.datalake.model.LogRuler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by jing.zigao on 2016/5/25.
 */
@Service
public class LogRulerService {

    @Autowired
    private LogRulerMapper logRulerMapper;

    public LogRuler getLogRulerBySubject(String subject){
        LogRuler lp = logRulerMapper.getLogRulerBySubject(subject);
        return lp;
    }

    public List<LogRuler> getAllLogRulers(){
        return logRulerMapper.getAllLogRulers();
    }

    public LogRuler getLogRulerByLogRuleId(long logRulerId){
        return logRulerMapper.getLogRulerById(logRulerId);
    }

    public void createLogRuler(LogRuler logRuler){
         logRulerMapper.addLogRuler(logRuler);
    }

    public void updateLogRuler(LogRuler logRuler){
         logRulerMapper.updateLogRuler(logRuler);
    }

    public String deleteLogRuler(LogRuler logRuler){
        logRulerMapper.deleteLogRuler(logRuler);
        return "deleted!";
    }

    public String deleteLogRuler(long logRulerId){
        logRulerMapper.deleteLogRulerById(logRulerId);
        return "deleted!";
    }
}
